package day9.Exer;

import java.util.Scanner;

public class Leasingtest {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        LeasingCenter a = new LeasingCenter("金路至尊租赁有限公司", "999999999");
        a.showcenter();
        while (true) {
            System.out.println("1.查看车辆情况；2.租赁；3.还车；4.报废；5.采购新车；6.查看租赁记录；9.退出");
            int chosennum = in.nextInt();
            switch (chosennum) {
                case 1: {
                    System.out.println("车辆信息如下：");
                    a.showAllcar();
                    break;
                }
                case 2: {

                    System.out.println("请选择要租赁的车型：");
                    String chosenCar = in.next();
                    a.showCarin(chosenCar);
                    System.out.println("请选择要租的车，请输入车牌号：");
                    String carNo = in.next();
                    a.leasecar(carNo);
                    System.out.println("请输入租赁天数:");
                    int day = in.nextInt();
                    a.calRent(carNo, day);
                    System.out.println("请录入顾客信息:");
                    System.out.println("姓名：");
                    String custName=in.next();
                    System.out.println("电话：");
                    String custPhone=in.next();
                    System.out.println("日期");
                    String custDate=in.next();
                    Customer b=new Customer(custName,custPhone,custDate,carNo,day);
                    a.addmessage(b);
                    break;
                }
                case 3: {
                    System.out.println("请输入车牌号：");
                    String carNo=in.next();
                    a.giveback(carNo);
                    break;
                }
                case 4: {
                    System.out.println("请输入要报废的车牌号：");
                    String scrapNo = in.next();
                    a.scrap(scrapNo);
                    break;
                }
                case 5: {
                    System.out.println("新车类型：1.轿车；2.客车");
                    while (true) {
                        int chosen = in.nextInt();
                        if (chosen == 1) {
                            boolean rent = true;
                            System.out.println("新车品牌");
                            String brand = in.next();
                            System.out.println("车牌号：");
                            String carNo = in.next();
                            System.out.println("日租金");
                            int rental = in.nextInt();
                            System.out.println("请输入型号");
                            String model = in.next();
                            Car c = new Saloon(brand, carNo, rental, rent, model);
                            a.addcar(c);
                            break;
                        } else if (chosen == 2) {
                            boolean rent = true;
                            System.out.println("新车品牌");
                            String brand = in.next();
                            System.out.println("车牌号：");
                            String carNo = in.next();
                            System.out.println("日租金");
                            int rental = in.nextInt();
                            System.out.println("座位数：");
                            int seat = in.nextInt();
                            Car c = new Passenger(brand, carNo, rental, rent, seat);
                            a.addcar(c);
                            break;
                        }
                        System.out.println("输入错误，再来：");
                    }
                    break;
                }
                case 6: {
                    a.showMessage();
                    break;

                }
                case 9: {
                    System.out.println("感谢使用，下次再见！");
                    return;
                }
            }
        }
    }

}
